#ifndef DATAMODEL_H
#define DATAMODEL_H

#include <QAbstractListModel>
#include <QVector>
#include "person.h"

class DataModel : public QAbstractListModel
{
Q_OBJECT
QVector<Person> m_data;
Person invalid;
public:
    DataModel(QObject *parent = 0);

    int rowCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
    const Person & getPerson(const QModelIndex &index);
    void saveData();
    void saveLocal(QModelIndex const & index, QString name, QString lastname,
                   QString phone, QString email, QString notes);
private:
    int person;

};

#endif // DATAMODEL_H
